package com.meanbean.studytime.controls;

/**
 * A button used in 'Edit' mode.
 * @author Derek Webb
 */
public class EditButton extends Button
{
	/**
	 * Creates an EditButton.
	 * @param x The X position of this button.
	 * @param y The Y position of this button.
	 * @param answer The answer String associated with this button.
	 */
	public EditButton(int x, int y, String answer)
	{
		super(x, y, answer);
		
		textField.setText(answer);
	}
	
	public void open()
	{
		super.open();
	}
	
	public void close()
	{
		super.close();
		
		// Store the answer
		if (!textField.getText().equals(""))
			answer = textField.getText().trim();
	}
}
